package com.wanlian.router.net.internal;

import android.support.annotation.NonNull;

import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.wanlian.router.net.ResponseData;

import okhttp3.Headers;

/**
 * Created by Hyu on 2016/7/11.
 * Email: fvaryu@qq.com
 */
public class DefaultParser extends IParser {

    @Override
    public ResponseData parser(@NonNull Gson gson, int resultCode, Headers headers, String response) {
        ResponseData res;
        try {
            res = gson.fromJson(response, ResponseData.class);

        } catch (JsonSyntaxException e) {
            res = new ResponseData();
        }
        return res;
    }
}
